package cn.wgx.modules.base.web;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

@Api(description = "test")
@RestController
@RequestMapping(value = "/test")
@Slf4j
public class TestCtrl extends BaseController{

    @GetMapping(value = "")
    public Object t(@RequestParam(defaultValue = "true") String s, @RequestHeader HttpHeaders httpHeaders, HttpServletResponse httpServletResponse){
        httpHeaders.add("testHeader", s);
        httpServletResponse.addHeader("httpServletResponsetest", s);
        switch (s){
            case "debug": logger.debug(s);break;
            case "info":  logger.info(s);break;
            case "error": logger.error(s);break;
        }
        return returnData(s);
    }



}
